package com.example.administrator.daggerdemo;

import android.os.Bundle;
import android.widget.Toast;

import com.example.administrator.daggerdemo.base2.base.BaseActivity;
import com.example.administrator.daggerdemo.model.network.response.GetSMSCodeResponseInfo;
import com.example.administrator.daggerdemo.model.network.response.RegisterResponseInfo;
import com.example.administrator.daggerdemo.presenter.RegisterActivityPresenter;
import com.example.administrator.daggerdemo.view.IRegisterActivityView;

/**
 * Created by zhengjian on 2016/12/13.
 */
public class RegisterActivity extends BaseActivity implements IRegisterActivityView {

    RegisterActivityPresenter presenter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initData();
    }

    @Override
    protected void initPresenter() {
        presenter=new RegisterActivityPresenter(this);
    }

    @Override
    protected void initData() {
         super.initData();
        getSMS();
    }

    @Override
    protected void initView() {

    }

    @Override
    public void register() {
        presenter.register("15711963065","3333333","d");
    }

    @Override
    public void registerSuccess(RegisterResponseInfo info) {

    }

    @Override
    public void getSMS() {
        presenter.getSMS("15711963065");
    }

    @Override
    public void getSMSSuccess(GetSMSCodeResponseInfo info) {
        register();
    }


    @Override
    public void toast(String msg) {
        Toast.makeText(this,msg,Toast.LENGTH_SHORT).show();
    }

    @Override
    public void showProgress() {
        Toast.makeText(this, "开始请求", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void hideProgress() {
        Toast.makeText(this,"结束请求",Toast.LENGTH_SHORT).show();
    }

    @Override
    public void msgError(String errorString) {
        Toast.makeText(this,errorString,Toast.LENGTH_SHORT).show();
    }
}
